package realm.inorder.itmill.components;

import com.itmill.toolkit.ui.Layout;
import com.itmill.toolkit.ui.Window;

public abstract class AbstractWindow extends Window implements InitializableView {

	public AbstractWindow() {
	}
	
	public AbstractWindow(String caption, Layout layout) {
		super(caption, layout);
	}

	public AbstractWindow(String caption) {
		super(caption);
	}
	{
		initComponents();
	}

	public void afterPropertiesSet() throws Exception {
		initActions();
		clearComponents();
	}

	public void clearComponents() {
	}

	public boolean validateForm() {
		try {
			validateComponents();
			return true;
		} catch (Exception e) {
			String message = e.getMessage();
			this.getApplication().getMainWindow().showNotification(message, Notification.TYPE_ERROR_MESSAGE);
			return false;
		}
	}
	
}
